package com;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

import com.bean.Student;
import com.opensymphony.xwork2.ActionSupport;
import com.service.StudentService;


public class ModifyStudent extends ActionSupport {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	@Resource(type=Student.class)
	private Student student;
	
	@Autowired
	@Qualifier("studentService")
	private StudentService studentService;

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	public void setStudent(Student student) {
		this.student = student;
	}

	@Override
	public String execute() throws Exception {
		try 
		{
			setStudent(studentService.getStudentById(student.getId()));
			return SUCCESS;
		}
		catch (Exception e) 
		{
			e.printStackTrace();
			return ERROR;
		}
	}

}
